#pragma once 

#include"Reactor.hpp"
#include"sock.hpp"
#include "Util.hpp"
#include"Service.hpp"
int Accepter(Event* evp)
{
  cout<<"有新的链接到来了，就绪的sock: "<<evp->sock<<endl;
  while(true)
  {
    int sock = Sock::Accept(evp->sock);
    if(sock<0)
    {
      std::cout<<"Accept Done"<<std::endl;
      break;
    }
    cout<<"Accept success: "<<sock<<endl;
    SetNonBlock(sock);
    //获取连接成功
    Event* other_ev = new Event();
    other_ev->sock = sock;
    other_ev->R = evp->R;// ?? 
    other_ev->RegisterCallback(recver,sender,errorer);//
    evp->R->InsertEvent(other_ev,EPOLLIN|EPOLLET);

  }
}
